import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class fondo here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class fondo extends Actor
{
    /**
     * Act - do whatever the fondo wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    private int num;
    private GreenfootImage asdf = new GreenfootImage("Mundo1.png");
    private int x1;
    private int y1;
    private int Velocidad;  

    private GreenfootImage menu=new GreenfootImage("Menu.png");
    private GreenfootImage tutorial1;
    private GreenfootImage tutorial2;
    private int tutorial;
    private int tipoFondo;

  
    public fondo(int posicion,int x,int y,int fondo){
        tipoFondo=fondo;   
        tutorial=0;  

        if(tipoFondo==0){
            setImage(menu);
        }

        if(tipoFondo==1){
            setImage(asdf);
            num=posicion;
            x1=x;
            y1=y;  
            Velocidad=1;
        }   
        if(tipoFondo==2){
            cargaImagenesTutorial();
        }

    
    }

    
    public void act() 
    {
        if(tipoFondo==1){      
            setLocation(this.getX()-Velocidad,this.getY());
            if(getX()==-400)       
                this.regresaAPosI();
        }
        if(tipoFondo==2){
            Tutorial();
        }      
    }

    public void regresaAPosI(){
        setLocation(950,200);

    }
    public void cargaImagenesTutorial(){
        tutorial1=new GreenfootImage("Tutorial1.png");
        tutorial2=new GreenfootImage("Tutorial2.png");
    }
    public void sigTutorial(){
        if(tutorial!=3){tutorial++;}else{World aux=getWorld(); ((Menu)aux).quitaTutorial();}
    }
    public void Tutorial(){
    if(tutorial==0){setImage(tutorial1);}
     if(tutorial==1){setImage(tutorial2);}
      if(tutorial==2){setImage(tutorial1);}
       if(tutorial==3){setImage(tutorial2);}
    }
}

